<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="dist/vue.js"></script>
</head>
<body>
  <div id="app">
    <div v-if="flag">真真</div>
    <div v-else>假假</div>

    <div v-show="flag">真真真</div>
    <div v-show="!flag">假假假</div>

    <h1>v-if + key值</h1>
    <template v-if="loginType === 'username'">
      <label for="">用户名</label>
      <input type="text" placeholder="用户名">
    </template>
    <template v-if="loginType === 'email'">
      <label for="">邮箱</label>
      <input type="text" placeholder="邮箱">
    </template>
    <h2>添加key</h2>
    <template v-if="loginType === 'username'">
      <label for="">用户名</label>
      <input type="text" placeholder="用户名" key="username">
    </template>
    <template v-if="loginType === 'email'">
      <label for="">邮箱</label>
      <input type="text" placeholder="邮箱" key="email">
    </template>
  </div>
</body>
<script>
  // v-if 与 v-show的区别
  const vm = new Vue({
    el: '#app',
    data: {
      flag: true,
      loginType: 'username'
    }
  })
</script>
</html>